package com.springweb.unit3.spEL;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import com.springweb.unit3.spEL.impl.BlankDisc;
import com.springweb.unit3.spEL.impl.GreenDisc;


@Configuration
@PropertySource("classpath:/property/cd.properties")
public class CDConfig {
	
	
	@Bean("greenDisc")
	public CompactDisc greenDisc() {
		return new GreenDisc("宝石", "green");
	}
	
	@Value("#{greenDisc.title}")
	private String title;
	@Value("#{greenDisc.getArtist()?.toUpperCase()}")
	private String artist;
	@Value("#{T(java.lang.Math).PI}")
	private Double pi;
	
	@Bean("blankDisc")
	public CompactDisc blankDisc() {
		return new BlankDisc(title, artist, pi);
	}
}
